package com.shikong.blog.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shikong.blog.common.Response;
import com.shikong.blog.domain.dos.BlogMineDO;
import com.shikong.blog.domain.mapper.BlogMineMapper;
import com.shikong.blog.model.webvo.blogsetting.QueryBlogMineRspVO;
import com.shikong.blog.service.BlogMineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @Description: TODO
 * @Version: 1.0
 */
@Service
@Slf4j
public class BlogMineServiceImpl extends ServiceImpl<BlogMineMapper, BlogMineDO> implements BlogMineService {

    @Autowired
    BlogMineMapper blogMineMapper;

    @Override
    public Response queryBlogMineDetail() {
        BlogMineDO blogMineDO = getOne(null);

        QueryBlogMineRspVO queryBlogMineRspVO = null;
        if (Objects.nonNull(blogMineDO)) {
            queryBlogMineRspVO = QueryBlogMineRspVO.builder()
                    .pictureOne(blogMineDO.getPictureOne())
                    .textOne(blogMineDO.getTextOne())
                    .textTwo(blogMineDO.getTextTwo())
                    .pictureTwo(blogMineDO.getPictureTwo())
                    .textThree(blogMineDO.getTextThree())
                    .textFour(blogMineDO.getTextFour())
                    .pictureThree(blogMineDO.getPictureThree())
                    .textFive(blogMineDO.getTextFive())
                    .textSix(blogMineDO.getTextSix())
                    .pictureFour(blogMineDO.getPictureFour())
                    .textSeven(blogMineDO.getTextSeven())
                    .build();
        }
        return Response.success(queryBlogMineRspVO);
    }
}